/**
 * 
 */
package org.corpus.english.controller;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.corpus.english.model.Word;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.Listbox;
import org.zkoss.zul.Listitem;


/**
 * @author robbiecheng
 *
 */
public class WordSearchResultController extends GenericForwardComposer{
	private Word current = new Word();
	public void setCurrent(Word current) {
		this.current = current;
	}
	public Word getCurrent() {
		return current;
	}
	//update word
	private Listbox resultList;
	public void onClick$updateBtn(){
		Listitem item = resultList.getSelectedItem();
		if (item != null)
			UpdateManager.updateWord(((Word)item.getValue()).getWordid());
		
	}
	//export to word
	public void onClick$exportToWordBtn(){
		Map args = new HashMap();
		args.put("results", resultList.getSelectedItems());
		args.put("config", page.getVariable("config"));
		UpdateManager.exporToWord(args, UpdateManager.WORD_WORD_EXAMPLE_URL);
	}
}
